﻿using System;
using System.Management.Automation.Host;

namespace BGShell.PowerShell.Host
{
    internal sealed class RunspacePSHostRawUI : PSHostRawUserInterface
    {
        private readonly IRunspaceHostRawUI _owner;

        public RunspacePSHostRawUI(IRunspaceHostRawUI owner)
        {
            _owner = owner;
        }

        public override ConsoleColor BackgroundColor
        {
            get { return _owner.BackgroundColor; }
            set { _owner.BackgroundColor = value; }
        }
        
        public override Size BufferSize
        {
            get { return _owner.BufferSize; }
            set { _owner.BufferSize = value; }
        }
        
        public override Coordinates CursorPosition
        {
            get { return _owner.CursorPosition; }
            set { _owner.CursorPosition = value; }
        }
        
        public override Int32 CursorSize
        {
            get { return _owner.CursorSize; }
            set { _owner.CursorSize = value; }
        }
        
        public override ConsoleColor ForegroundColor
        {
            get { return _owner.ForegroundColor; }
            set { _owner.ForegroundColor = value; }
        }
        
        public override Boolean KeyAvailable
        {
            get { return _owner.KeyAvailable; }
        }
        
        public override Size MaxPhysicalWindowSize
        {
            get { return _owner.MaxPhysicalWindowSize; }
        }
        
        public override Size MaxWindowSize
        {
            get { return _owner.MaxWindowSize; }
        }
        
        public override Coordinates WindowPosition
        {
            get { return _owner.WindowPosition; }
            set { _owner.WindowPosition = value; }
        }
        
        public override Size WindowSize
        {
            get { return _owner.WindowSize; }
            set { _owner.WindowSize = value; }
        }
        
        public override String WindowTitle
        {
            get { return _owner.WindowTitle; }
            set { _owner.WindowTitle = value; }
        }

        public override void FlushInputBuffer()
        {
            _owner.FlushInputBuffer();
        }

        public override BufferCell[,] GetBufferContents(Rectangle rectangle)
        {
            return _owner.GetBufferContents(rectangle);
        }

        public override KeyInfo ReadKey(ReadKeyOptions options)
        {
            return _owner.ReadKey(options);
        }

        public override void ScrollBufferContents(Rectangle source, Coordinates destination, Rectangle clip, BufferCell fill)
        {
            _owner.ScrollBufferContents(source, destination, clip, fill);
        }

        public override void SetBufferContents(Rectangle rectangle, BufferCell fill)
        {
            _owner.SetBufferContents(rectangle, fill);
        }

        public override void SetBufferContents(Coordinates origin, BufferCell[,] contents)
        {
            _owner.SetBufferContents(origin, contents);
        }
    }
}
